{// 引入标签库 }
<tagLib name="html" />
<include file="Public:header" />
<PHP>


    function get_nickname($id){
    if(!$id){
    return '';
    }
    $get_nickname=$GLOBALS['db']->getOne("select nick_name from ".DB_PREFIX."user where id=".$id);
    return emoji_decode($get_nickname);
    }
    function get_live_status_text($video_id,$xiacai){
    return $video_id?'<a href="/m.php?m=Xiacai&a=play&video_id='.$xiacai['room_id'].'&xiacai_id='.$xiacai['id'].'">直播中...</a> <a href="/mapi/index.php?ctl=video&act=end_video&user_id='.$xiacai['user_id'].'&room_id='.$xiacai['room_id'].'" class="btn-close">[关闭]</a>':'<a href="/m.php?m=Xiacai&a=start&xiacai_id='.$xiacai['id'].'">立即开播</a>';
    }
</PHP>
<load href='__TMPL__Common/js/jquery.bgiframe.js' />
<load href='__TMPL__Common/js/jquery.weebox.js' />
<load href='__TMPL__Common/js/deal.js' />
<load href='__TMPL__Common/js/user.js' />
<load href='__TMPL__Common/style/weebox.css' />
<script type="text/javascript" src="__TMPL__Common/js/calendar/calendar.php?lang=zh-cn" ></script>
<load href='__TMPL__Common/js/calendar/calendar.css' />
<load href='__TMPL__Common/js/calendar/calendar.js' />
<div class="main">
    <div class="main_title_list"><div class="list-line-ico"></div>瞎猜直播列表 <a href="/{$url_name}?m=Xiacai&a=index&&">刷新</a></div>
    <div class="search_row">
        <form name="search" action="__APP__" method="get" class="clearfix">
            <div>主播ID: <input type="text" class="textbox" name="user_id" value="{:trim($_REQUEST['user_id'])}" style="width:100px;" /></div>
            <div>主播昵称：<input type="text" class="textbox" name="nick_name" value="{:trim($_REQUEST['nick_name'])}" style="width:100px;" /></div>

            <div><input type="hidden" value="Xiacai" name="m" /><input type="hidden" value="index" name="a" /><input type="submit" class="button" value="{%SEARCH}" /></div>
        </form>
    </div>

    <html:list
        id="dataTable"
        style="dataTable"
        name="xiacai"
        action="true"
        datasource="list"
        show="id:瞎猜ID
        ,user_id:主播ID
        ,user_id|get_nickname=$xiacai['user_id']:主播昵称
        ,subject:节目名称
        ,start_time_tip:开播时间提示
        ,room_id|get_live_status_text=$xiacai:是否开播
        ,room_id:房间号
        ,subscribe_count:订阅人数
        ,create_time|to_date:创建时间
        ,sort|get_sort=$xiacai['id']:{%SORT}"
        actionlist="edit:{%EDIT},foreverdel:{%DEL},guessingedit:竞猜设置,playback:回播列表" />
    <table class="dataTable">
        <tbody>
        <td colspan="5">
            <input type="button" class="button button-add" value="{%ADD}" onclick="add();" />
        </td>
        </tbody>
    </table>
    <div class="page">{$page}</div><!--(数值越大在app热门直播中越靠前)  ,vote_number:{%TICKET}-->
</div>
<script>
    function guessingedit(xiacai_id) {
        location.href = '/m.php?m=Guessing&a=edit&xiacai_id=' + xiacai_id;
    }
    function playback(xiacai_id) {
        location.href = '/m.php?m=XiacaiVideoPlayback&a=playback_index&xiacai_id=' + xiacai_id;
    }
    // 关闭直播
    $('.btn-close').click(function () {
        if (!confirm("确定关闭这个直播？")) {
            return false;
        }
        var url = $(this).attr('href');
        $.post(url,function(result){
          result=JSON.parse(result);
          if(result.status){
            location.reload();
          }else{
              alert(result.error);
          }
        });
        return false;
    })
</script>
<include file="Public:footer" />